<template>
	<view class="container">
		<u-navbar height="50" :safeAreaInsetTop="false" :statusbarTop="vuex_statusBarHeight+8" placeholder>
			<view class="u-nav-slot" slot="left">
				<view class="sLeft dfx alc">
					<u-avatar :src="vuex_userInfo.face" size="40"></u-avatar>
					<text class="ml15 fs40">{{vuex_userInfo.name}}</text>
				</view>
			</view>
			<view class="u-nav-slot" slot="right">
				<u-icon name="edit-pen-fill" size="28" color="#fff" @click="add()"></u-icon>
			</view>
		</u-navbar>

		<view class="banner df">
			<view class="b_item">
				<view class="dfx alc center">
					<image src="@/static/img/mine/i_time.png" mode=""></image>
					合成时长
				</view>
				<view class="text-main bold mt16">
					{{userInfo.time}}秒
				</view>
			</view>
			<view class="b_item" @click="$tools.navTo('index/painting')">
				<view class="dfx alc center">
					<image src="@/static/img/mine/i_draw.png" mode=""></image>
					AI绘画次数
				</view>
				<view class="text-main bold mt16">
					{{userInfo.draws}}次
				</view>
			</view>
		</view>

		<view class="con">
			<view class="list pd30">
				<view class="ltitle df jb">
					<view class="fs34b df" style="color: #1c2541;" @click="fun">
						其他功能
					</view>
				</view>
				<view class="lylist">
					<view class="lyli">
						<view class="lycommon" @click="$tools.navTo('my/activate')">
							<view class="pic">
								<image src="../../static/img/mine/time.png" mode=""></image>
							</view>
							<view class="txt">
								<text v-show="userinfo.is_expire==1">激活兑换码</text>
								<text v-show="userinfo.is_expire==0">过期时间<text
										style="margin-left: 23vw;">{{userinfo.expire_time}}</text></text>
							</view>
						</view>
					</view>
					<view class="lyli">
						<view class="lycommon">
							<view class="pic">
								<image src="../../static/img/mine/time.png" mode=""></image>
							</view>
							<view class="txt">
								<text>当前版本<text style="margin-left: 40vw;">{{version}}</text></text>
							</view>
						</view>
					</view>
					<view class="lyli">
						<view class="lycommon">
							<view class="pic">
								<image src="../../static/img/mine/about.png" mode=""></image>
							</view>
							<view class="txt">
								<text>关于我们</text>
							</view>
						</view>
					</view>
					<view class="lyli">
						<view class="lycommon" @click="logout">
							<view class="pic">
								<image src="../../static/img/mine/close.png" mode=""></image>
							</view>
							<view class="txt">
								<text>退出登录</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				idx: 0,
				userInfo: {
					avatar: '../../static/mine/hot.png',
					time: '999',
					draws: '99'
				},
				userinfo: {
					avatar: "/static/unielepystatic/img/lycenter/defaultAvatarUrlgrey.png",
					nickname: "默认用户",
					is_expire: 1
				},
				version:'1.0.0',
				list: [{
					name: '讲解话术'
				}, {
					name: '互动话术'
				}],
				list1: [
					'https://cdn.uviewui.com/uview/swiper/swiper1.png'
				],
				livelist: [],
				current: 0, // tabs组件的current值，表示当前活动的tab选项

			}
		},
		// 监听页面加载
		onLoad() {
			this.getSystem()
		},
		onShow() {
			this.getData()
		},
		methods: {
			getSystem() {
				console.log(111);
				uni.getSystemInfo({
					success: res => {
						console.log(res, 111);
						this.$tn.vuex('vuex_statusBarHeight', res.statusBarHeight);
						// console.log(this.vuex_statusBarHeight, '测试打印-vuex_userInfo')
					}
				})
			},
			fun() {
				// uni.setStorageSync('showProduct', 'carProduct')
				uni.setStorageSync('current', 2)
				this.$tools.navTo('webview/webview')
			},
			getData() {
				let params = {
					...this.formInline
				}
				this.$api.list(params).then(res => {
					if (res.code == 200) {
						if (this.formInline.page == 1) {
							this.livelist = res.data.list
						} else {
							this.livelist = this.livelist.concat(res.data.list)
						}
						this.formInline.total = res.data.count
					} else {
						this.$tools.toast(res.msg);
					}
				})
			},

			change(e) {
				console.log(e, 111111);
				this.current = e
			},
			//tabs通知swiper切换
			tabsChange(index) {
				this.current = index;
			},
			//swiper滑动中
			swiperTransition(e) {
				// this.$refs.tabs.setDx(e.detail.dx);
			},
			//swiper滑动结束
			swiperAnimationfinish(e) {
				this.current = e.detail.current;
			},
			logout() {
				uni.clearStorageSync()
				uni.reLaunch({
					url: '/pages/login/login'
				})
				
				// uni.getSystemInfo({
				// 	success: (res) => {
				// 		let params = {
				// 			deviceId: res.deviceId,
				// 		}
				// 		this.$api.logout(params).then(res => {
				// 			this.$tools.toast(res.msg);
				// 			if (res.code == 200) {
								
				// 			}
				// 		})
				// 	}
				// });
			}
		},
	}
</script>

<style lang="scss" scoped>
	/deep/.u-navbar__content {
		background: linear-gradient(45deg, #e6f2fd, #ddedfd, #ddebfd) !important;
	}

	.container {
		background: url("@/static/img/mine/mineBg.png") no-repeat;
		height: 100vh;
		overflow: hidden;

		.searchBox {
			width: 100%;
			height: 70rpx;
			color: #000;

			.sLeft {
				height: 100%;
				justify-content: flex-start;
				padding-left: 24rpx;
			}

			.sBtn {
				height: 100%;
				width: 140rpx;
				color: #222;
			}
		}

		.banner {
			margin: 50rpx 30rpx 0;
			height: 200rpx;
			border-radius: 16rpx;
			background: url('@/static/img/mine/mine_banner.png') no-repeat;
			background-size: cover;
			padding: 20rpx 0;
			box-sizing: border-box;

			.b_item {
				width: 50%;
				text-align: center;
				padding: 30rpx 60rpx;
				color: #767676;
			}

			.b_item:last-child {
				border-left: 1px solid #d6e8fd;
			}

			image {
				width: 32rpx;
				height: 32rpx;
			}
		}

		.con {
			// border-radius: 40rpx;
			// background-color: #fff;
			margin: 30rpx 30rpx 0;
			// height: 80vh;
			background: url("../../static/img/mine/mine_fbg.png") no-repeat;
			background-size: cover;
			// background-size: contain;
			overflow: hidden;
			min-height: 65vh;
		}

		.list {
			margin-top: 40rpx;
			border-radius: 24rpx;

			.lylist {
				overflow: hidden;
				padding-top: 40rpx;
				padding-bottom: 50rpx;
				border-radius: 16rpx;

				.lyli {
					padding: 40rpx 0;
					overflow: hidden;
					position: relative;

					// border-bottom: 1px solid rgb(242, 242, 242);

					.pic {
						float: left;
						margin-right: 30rpx;

						image {
							width: 60rpx;
							height: 60rpx;
						}
					}
				}

				.lyli2 {
					padding: 30rpx 0;
					overflow: hidden;
					position: relative;

					/* border-bottom: 1px solid rgb(242, 242, 242); */
					.pic {
						float: left;
						margin-right: 30rpx;
					}

					.txt {
						overflow: hidden;
						font-size: 30rpx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #5e7090;
						padding-bottom: 10rpx;
					}
				}
			}


			.lyli::after {
				content: '';
				position: absolute;
				border-top: 3rpx solid rgb(179, 179, 179);
				border-left: 3rpx solid rgb(179, 179, 179);
				width: 16rpx;
				height: 16rpx;
				right: 5rpx;
				top: 40%;
				transform: rotate(135deg);
			}
		}
	}
</style>